#include "shortcuts.hpp"

#include "data\slide_show.hpp"

#define CSLIDE g_slides.slides[g_slides.current_slide]

#define BODIES CSLIDE.bodys
#define CBODY CSLIDE.bodys[g_slides.slides[g_slides.current_slide].current_body]
#define SHAPES CBODY.shapes
#define CSHAPE SHAPES[CBODY.current_shape]

bool active_slide()
{
	int cslide = g_slides.current_slide; 

	if( cslide < 0 || cslide >= (int)g_slides.slides.size() )
		return false;

	return true;
}

bool active_body()
{
	int cslide = g_slides.current_slide; 
	int cbody = 0;
	if( cslide >= 0 )
		cbody=CSLIDE.current_body;
	else
		return false;
	if( cslide >= (int)g_slides.slides.size() ||
		cbody < 0 || cbody >= (int)g_slides.slides[cslide].bodys.size() )
		return false;

	return true;
}

bool active_shape()
{
	int cslide = g_slides.current_slide; 
	int cbody = 0; int cshape =0;
	if( cslide >= 0 )
		cbody=CSLIDE.current_body;
	else
		return false;
	if( cbody >= 0 )
		cshape=CBODY.current_shape;
	else
		return false;

	if( cslide >= (int)g_slides.slides.size() ||
		cbody >= (int)g_slides.slides[cslide].bodys.size() ||
		cshape < 0 || cshape >= (int)SHAPES.size() )
		return false;

	return true;
}
bool active_vertex()
{
	int cslide = g_slides.current_slide; 
	int cbody = 0; int cshape =0;
	if( cslide >= 0 )
		cbody=CSLIDE.current_body;
	else
		return false;
	if( cbody >= 0 )
		cshape=CBODY.current_shape;
	else
		return false;

	if( cslide >= (int)g_slides.slides.size() ||
		cbody >= (int)g_slides.slides[cslide].bodys.size() ||
		cshape < 0 || cshape >= (int)SHAPES.size() )
		return false;
	
	int cvertex = CSHAPE.current_polygon;
	if( cvertex <0 || cvertex >= CSHAPE.polygon_points.size() )
		return false;


	return true;
}